package elizascript;

import java.util.ArrayList;

/**
 * DecompositionRule is mostly just a data structure to store decomposition rules in a convenient way.
 * 
 * @author Adam
 *
 */
public class DecompositionRule implements Cloneable
{
	public String DecompositionRule;
	
	public boolean isCommand()
	{
		return rule_type == 1;
	}
	
	public boolean isResponseRule()
	{
		return rule_type == 2;
	}
	
	protected int rule_type = 0;
	
	public ArrayList<String> AssemblyRules;
	public String Command;
	
	public int nextUsedAssemblyRule;
	
	public DecompositionRule()
	{
		AssemblyRules = new ArrayList<String>();
		nextUsedAssemblyRule = 0;
	}
	
	// Required to be able to "clone" an object.
	// http://stackoverflow.com/questions/5116264/the-method-clone-from-object-is-not-visible
	public Object clone()
	{
		try
		{
			return super.clone();
		}
		catch(Exception e)
		{
			return null;
		}
	}
}